//
//  TuiKuanDetailTableViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/10/11.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "TuiKuanDetailTableViewCell.h"

@implementation TuiKuanDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    UIView *v1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, rateHeight(100))];
    v1.backgroundColor = UIColorWhite;
    [self addSubview:v1];
    
    self.titleLB = [UILabel labelWithText:@"商品标题" textColor:UIColorFromRGB(0x333333) fontSize:15];
    [self.titleLB sizeToFit];
    [v1 addSubview:self.titleLB];
    [self.titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(v1);
        make.left.equalTo(v1).offset(rateWidth(30));
    }];
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = tableViewBgColor;
    [v1 addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(v1);
        make.height.equalTo(@(rateHeight(2)));
        make.left.equalTo(v1).offset(rateWidth(20));
        make.right.equalTo(v1).offset(-rateWidth(20));
    }];
    
    UIView *v2 = [[UIView alloc] initWithFrame:CGRectMake(0, rateHeight(100), kScreenWidth, rateHeight(220))];
    v2.backgroundColor = UIColorWhite;
    [self addSubview:v2];
    
    self.goodsImg = [[UIImageView alloc] init];
    self.goodsImg.image = UIImageNamed(@"picaoimg");
    [v2 addSubview:self.goodsImg];
    [self.goodsImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_offset(CGSizeMake(rateHeight(170), rateHeight(170)));
        make.left.equalTo(v2).offset(rateWidth(30));
        make.centerY.equalTo(v2);
    }];
    
    self.priceLB = [UILabel labelWithText:@"价格：0.01" textColor:UIColorFromRGB(0x999999) fontSize:12];
    [self.priceLB sizeToFit];
    [v2 addSubview:self.priceLB];
    [self.priceLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.goodsImg.mas_right).offset(rateWidth(30));
        make.bottom.equalTo(self.goodsImg.mas_centerY).offset(-rateHeight(40));
    }];
    
    self.numLB = [UILabel labelWithText:@"数量：×1" textColor:UIColorFromRGB(0x999999) fontSize:12];
    [self.numLB sizeToFit];
    [v2 addSubview:self.numLB];
    [self.numLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.priceLB);
        make.centerY.equalTo(self.goodsImg);
    }];
    
    self.timeLB = [UILabel labelWithText:@"购买时间：2018-10-10" textColor:UIColorFromRGB(0x999999) fontSize:12];
    [self.timeLB sizeToFit];
    [v2 addSubview:self.timeLB];
    [self.timeLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.priceLB);
        make.top.equalTo(self.goodsImg.mas_centerY).offset(rateHeight(40));
    }];
    
}

@end
